export default class LineManager {

    public static instance:LineManager = new LineManager();

    private nodePool:cc.NodePool;

    private prefab:cc.Prefab = null;


    public init(prefab:cc.Prefab){
        this.prefab = prefab;
        this.nodePool = new cc.NodePool();
        for(let i=0; i<10; i++){
            this.nodePool.put(cc.instantiate(prefab))
        }
    }

    public getNode(){
        let returnNode:cc.Node;
        if(this.nodePool.size() > 0){
            returnNode = this.nodePool.get();
        }else{
            returnNode = cc.instantiate(this.prefab);
        }
        return returnNode;
    }

    public recoverNode(node:cc.Node){
        this.nodePool.put(node)
    }

}